from functools import cached_property
from webutils.layers.managers.redis import JsonMixin, ListMixin

from .base import BaseManager


class Counter(JsonMixin, ListMixin, BaseManager):
    required_context = ['room_id', 'counter_id']
    """计数器
    """
    @cached_property
    def list_key(self):
        return self.get_redis_key(f'counter:{self.room_id}:{self.counter_id}')
